<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Admins
 *
 * @author phuong
 */
class Setting extends AppModel {

    public $name = 'Setting';
    public $useTable = "setting";
    public $primaryKey = 'Id';
    //put your code here
    public $validate = array(
        'Title' => array(
            'notEmpty' => array(
                'rule' => array('notEmpty'),
                'message' => '物件IDを入力してください。',
            ),
        ),
        'Value' => array(
            'notEmpty' => array(
                'rule' => array('notEmpty'),
                'message' => '物件IDを入力してください。',
            ),
        ),
    );

    /**
     * 
     */
    public function setValidateTimePing() {
        $this->validate['Value']['numberic'] = array(
            'rule' => array('isNumeric'),
            'message' => 'Please enter numberic more than 0',
        );
    }
    
    /**
     * 
     */
    public function setValidateEmail() {
        $this->validate['Value']['email'] = array(
            'rule' => array('email'),
            'message' => 'Please enter email',
        );
    }
    
    /**
     * 
     */
    public function isNumeric($params){
        if(is_numeric($params['Value']) && $params['Value'] >= 1)
            return true;
        return false;
    }

}
